package com.qn.wechat.common;

import org.dozer.DozerConverter;

import java.util.Date;

public class MapperDateConverter extends DozerConverter<Long, Date> {
    public MapperDateConverter() {
        super(Long.class, Date.class);
    }

    public Date convertTo(Long source, Date destination) {
        return source == 0L ? null : new Date(source);
    }

    public Long convertFrom(Date source, Long destination) {
        return source != null ? source.getTime() : 0L;
    }
}
